Minimizing Energy Consumption Leads To The Emergence Of Gaits In Legged Robots